package com.example.geoquiz

import androidx.lifecycle.ViewModel
import com.example.myapplicationandroidstudy.R
import com.example.util.Mlog

class QuizViewModel :ViewModel(){
//    init {
//        Mlog.iQuizViewModel("ViewModel instance created")
//    }
//
//    override fun onCleared() {
//        super.onCleared()
//        Mlog.iQuizViewModel("ViewModel instance about to be destroyed")
//    }

    private val questionBak= listOf(
            Question(R.string.question_australia,true),
            Question(R.string.question_oceans,true),
            Question(R.string.question_1,true),
            Question(R.string.question_2,false),
    )
    var currentIndex=0

    val currentQuestionAnswer:Boolean  get() = questionBak[currentIndex].answer
    val currentQuestionText:Int  get() = questionBak[currentIndex].textResId

    fun moveToNext(){
        currentIndex=(currentIndex+1) % questionBak.size
    }

    fun moveToPrev(){
        currentIndex=(currentIndex-1) % questionBak.size
    }

}